<template>
  <div>
    <div>B组件 : {{ count }}</div>
    <div><button @click="sub">sub</button></div>

    <div>
      <div>num : {{ num }}</div>

      <div><button @click="addNum">addNum</button></div>
    </div>
  </div>
</template>

<script>
import { mapState, mapActions } from 'vuex';

export default {
  methods: {
    ...mapActions(['increment', 'decrement', 'addNum']),
    sub() {
      this.decrement();
    },
  },
  computed: {
    ...mapState({
      count: (state) => state.count,
      num: (state) => state.number.num,
    }),
  },
};
</script>

<style>
</style>
